<?php

$id=intval($_GET['id']);
$sub=blog_get_category_of_item($id);
$sub['main']['url']=blog_url_subcategory($sub['main']['id'],$sub['main']['alias']);

$cat=blog_get_category_of_item($sub['main']['parent']);
$cat['subcategory']=$sub['main'];




$cache=new cache;
	$og_url=HOME."blog/s$id/".$cat['main']['alias']."/";
	//-------------------------- GET TRUYEN ----------------
    $sql ="SELECT id,name,alias,upload_user,upload_time,post,category,subcategory,view from blog_post where subcategory=$id and status=1 order by id desc ";
	$sql2="SELECT id from blog_post where  subcategory=$id and status=1";

	$pager = new Pagination($sql, 20, 5,$og_url,500,"blog_get_user");
	$pager->setDebug(false);
	$cache=new cache;
	$data[info] = $pager->paginate($cache,$sql2);
	$data[nav]	= $pager->renderFullNav();
	
	



			$data1[title]=web_title($cat['subcategory']['seo_title']);
			$data1['mota']=web_des($cat['subcategory']['seo_description']);
			$data1['keyword']=web_keyword($cat['subcategory']['seo_keyword']);
$data['category']=$cat;			

loadview('template/header_blog',$data1);
loadview("blog/subcategory",$data);
loadview('template/footer_blog');
exit();